
import java.nio.file.Path;
import java.nio.file.WatchKey;
import com.june.filewatch.FileEvent;
import com.june.filewatch.FileListener;
import com.june.filewatch.FileWatch;

public class Example {

	public static void main(String[] args) throws Exception {
		FileListener fileListener = new FileListener() {
			
			@Override
			public void modifyListener(Path path) {
				System.out.println("modify "+path.toString());
			}
			
			@Override
			public void deleteListener(Path path) {
				System.out.println("delete "+path.toString());
			}
			
			@Override
			public void createListener(Path path) {
				System.out.println("create "+path.toString());
			}
		};
		WatchKey watchKey = FileWatch.addWatch("E:\\新建文件夹", true, true, fileListener, FileEvent.FILE_CREATE,FileEvent.FILE_DELETE,FileEvent.FILE_MODIFY);
		Thread.sleep(2000);
		FileWatch.removeWatch(watchKey);
	}
}
